<?php 
class indexcontroller extends controller{
public function index(){
	$index=factory::getclass('indexmodel');
	$res=$index->indexlist();
	$this->v->assign('res',$res);
	$this->v->display('./app/'.MUDEL.'/view/index/'.CONTROLLER.'.html');

}
public function del(){
	$del=factory::getclass('indexmodel');
	$id=$_GET['id'];
	$res=$del->del($id);
	// var_dump($res);die;
	if ($res) {
		echo '<script>alert("nice");
     window.location.href="index.php"
	</script>';
	}else{
			echo "<script>alert('low');
     window.location.href='index.php'  
	</script>";
	}
}
public function update(){
$update=factory::getclass('indexmodel');
	$id=$_GET['id'];
	$res=$update->update($id);
	$this->v->assign('res',$res);
	$this->v->display('./app/'.MUDEL.'/view/index/update.html');
}
public function up(){
	$up=factory::getclass('indexmodel');
	$id=$_POST['id'];
	$title=$_POST['title'];
	$zuozhe=$_POST['zuozhe'];
	$content=$_POST['content'];
	$res=$up->up($id,$title,$title,$content);
	if($res) {
		echo '<script>alert("nice");
     window.location.href="index.php"
	</script>';
	}else{
			echo "<script>alert('low');
     window.location.href='index.php'  
	</script>";
	}
}
public function add(){
	$this->v->display('./app/'.MUDEL.'/view/index/add.php');
}
public function addy(){
	$title=$_POST['title'];
	$zuozhe=$_POST['zuozhe'];
	$content=$_POST['content'];
	$time=time();
	$addy=factory::getclass('indexmodel');
	$res=$addy->addy($title,$title,$content,$time);
	if($res) {
		echo '<script>alert("nice");
     window.location.href="index.php"
	</script>';
	}else{
			echo "<script>alert('low');
     window.location.href='index.php'  
	</script>";
	}
	}
	public function denglu(){
		$this->v->display('./app/'.MUDEL.'/view/index/denglu.php');
	}
}

 ?>